package com.ruoyi.forum.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.forum.domain.vo.PostCollectUpvote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.forum.mapper.ForumPostCollectMapper;
import com.ruoyi.forum.domain.ForumPostCollect;
import com.ruoyi.forum.service.IForumPostCollectService;

/**
 * 贴子-收藏Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-02-13
 */
@Service
public class ForumPostCollectServiceImpl implements IForumPostCollectService 
{
    @Autowired
    private ForumPostCollectMapper forumPostCollectMapper;

    /**
     * 查询贴子-收藏
     * 
     * @param id 贴子-收藏主键
     * @return 贴子-收藏
     */
    @Override
    public ForumPostCollect selectForumPostCollectById(Long id)
    {
        return forumPostCollectMapper.selectForumPostCollectById(id);
    }

    /**
     * 查询贴子-收藏列表
     * 
     * @param forumPostCollect 贴子-收藏
     * @return 贴子-收藏
     */
    @Override
    public List<ForumPostCollect> selectForumPostCollectList(ForumPostCollect forumPostCollect)
    {
        return forumPostCollectMapper.selectForumPostCollectList(forumPostCollect);
    }

    /**
     * 新增贴子-收藏
     * 
     * @param forumPostCollect 贴子-收藏
     * @return 结果
     */
    @Override
    public int insertForumPostCollect(ForumPostCollect forumPostCollect)
    {
        forumPostCollect.setCreateTime(DateUtils.getNowDate());
        return forumPostCollectMapper.insertForumPostCollect(forumPostCollect);
    }

    /**
     * 修改贴子-收藏
     * 
     * @param forumPostCollect 贴子-收藏
     * @return 结果
     */
    @Override
    public int updateForumPostCollect(ForumPostCollect forumPostCollect)
    {
        return forumPostCollectMapper.updateForumPostCollect(forumPostCollect);
    }

    /**
     * 批量删除贴子-收藏
     * 
     * @param ids 需要删除的贴子-收藏主键
     * @return 结果
     */
    @Override
    public int deleteForumPostCollectByIds(Long[] ids)
    {
        return forumPostCollectMapper.deleteForumPostCollectByIds(ids);
    }

    /**
     * 删除贴子-收藏
     *
     * @param postCollectUpvote 需要删除的数据用户id和帖子id
     * @return 结果
     */
    @Override
    public int deleteForumPostCollectByUserPost(PostCollectUpvote postCollectUpvote) {
        return forumPostCollectMapper.deleteForumPostCollectByUserPost(postCollectUpvote);
    }

    /**
     * 删除贴子-收藏信息
     * 
     * @param id 贴子-收藏主键
     * @return 结果
     */
    @Override
    public int deleteForumPostCollectById(Long id)
    {
        return forumPostCollectMapper.deleteForumPostCollectById(id);
    }
}
